UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cStdEZlQiWKbFUxGW8nSdiizOKKOHhMRDf2L1wxyfdw=' 
WHERE 
  key_id = '375eaf04d4d13f73e97d4e63b5438099aee89a2b27e1663eac3a180f30a5cfd6' 
  AND (
    token = 'cStdEZlQiWKbFUxGW8nSdiizOKKOHhMRDf2L1wxyfdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020