UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OSP8I0op6ZA2szylxoE1gdAWbKbj+vF7kdXt67AhkmQ=' 
WHERE 
  key_id = '65b97796b6aa2f0253f88568434e7781c1a9e1be51200f488dbe21b8b5118e5f' 
  AND (
    token = 'OSP8I0op6ZA2szylxoE1gdAWbKbj+vF7kdXt67AhkmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068