UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wsul/g5wMTLOnTYMSIPz9rFuvPrYzXnIO+JN9iQ4WxE=' 
WHERE 
  key_id = 'e8b5cec3368b4f99ca16f15e706c2708332b8b69e35008e6575020536fb54e2f' 
  AND (
    token = 'Wsul/g5wMTLOnTYMSIPz9rFuvPrYzXnIO+JN9iQ4WxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046