UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VtsYwOVSofU8l67m91TAdNBLMEH+HnYyif8g3v560Gc=' 
WHERE 
  key_id = '16ef32d1067dea885752d2026a437797a11b772f7f6c4abc2ec830006f488269' 
  AND (
    token = 'VtsYwOVSofU8l67m91TAdNBLMEH+HnYyif8g3v560Gc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030