UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XU5NhAv1asXUw7h+lu8N746NItvxNEY95giT7uDc1Vo=' 
WHERE 
  key_id = 'ceef8b0b847e8f54db42a7e6c72ed251cc6f3f076df7924202a40c33eee6860f' 
  AND (
    token = 'XU5NhAv1asXUw7h+lu8N746NItvxNEY95giT7uDc1Vo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043