UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sI/kAr3Fz+75C+Y2d95gABSNtxyp2OyYJUBSsjP+rOY=' 
WHERE 
  key_id = 'ffe14a4127f28dc8174fb7d9f3cc95b6ad9a455456f0e31287d37331d15591e4' 
  AND (
    token = 'sI/kAr3Fz+75C+Y2d95gABSNtxyp2OyYJUBSsjP+rOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029