UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '70KUVu3Wd1Gz33kgLwEzCWDh+pU/CSlBQmlnSg8ul/4=' 
WHERE 
  key_id = 'd12faed41f54a45d55279222ff5726f6192136e5f23cb5116d21d3ca1e8d7818' 
  AND (
    token = '70KUVu3Wd1Gz33kgLwEzCWDh+pU/CSlBQmlnSg8ul/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031