UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x64ncaX99lx1N8KSXO4KfJTi1p5zXDsev7JaLcR8RZ8=' 
WHERE 
  key_id = '9fe0fb502922fa49840e3d8fb31a077c0043f53a09049482813b5ae80be88081' 
  AND (
    token = 'x64ncaX99lx1N8KSXO4KfJTi1p5zXDsev7JaLcR8RZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036