UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DZyiLHMskLyl6ZQsTa2L9HWTUD1MihxHpQV6C5bY3Qc=' 
WHERE 
  key_id = '364f5f63c384e9356093efbc17298284c24c39a95c61633044e6570c26573594' 
  AND (
    token = 'DZyiLHMskLyl6ZQsTa2L9HWTUD1MihxHpQV6C5bY3Qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017