UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dyKoE9zq5X1aCNQEiPuB8+yip9UZspmxohjq3ivdWPw=' 
WHERE 
  key_id = '156a22150243bef0aad1837e095cf754b46cf90b47ad120a51101f38b47787e7' 
  AND (
    token = 'dyKoE9zq5X1aCNQEiPuB8+yip9UZspmxohjq3ivdWPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036