UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NQjpSkNQ5el2lwdGwkU2fuBEJ31ZTg+17X1fHFdja64=' 
WHERE 
  key_id = '9b43de8647aae41f146a78ade40eb21a74dcdc80055898bc7948190da0991daa' 
  AND (
    token = 'NQjpSkNQ5el2lwdGwkU2fuBEJ31ZTg+17X1fHFdja64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035