UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JBxIVN66XH+1UH46eqbZ7pN2TUg36I7MGDsF1ys8+z0=' 
WHERE 
  key_id = '2ab738b0e9877b8cf042726f20cb1c2f0707d730cd8e69c899b534249c3fadb2' 
  AND (
    token = 'JBxIVN66XH+1UH46eqbZ7pN2TUg36I7MGDsF1ys8+z0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025