UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ptFv/Dd3c5g4zitQP7IP22MnpXa7XPm2rsyllvFtsE0=' 
WHERE 
  key_id = '36f9576c85810e75567cdb858049511c8f7a6fd62c8b7d36f82cab0b61656adf' 
  AND (
    token = 'ptFv/Dd3c5g4zitQP7IP22MnpXa7XPm2rsyllvFtsE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037