UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'duhKMEqYzIr0SLfcDgFII3euMPqiN1saaumtDfpCzmI=' 
WHERE 
  key_id = 'b9d9930f738dabae7f08b2faf0b8a0eae5a1764872c1239e1ae02a357b48073a' 
  AND (
    token = 'duhKMEqYzIr0SLfcDgFII3euMPqiN1saaumtDfpCzmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025