UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PxI28Q9rUFTMunqDa2z22X8C9+G1lvWKzh7abc95kzk=' 
WHERE 
  key_id = '51fd3540d746c6e564fe54c21257766b4a746636cc8d5248c5f9fb774e1b2dfa' 
  AND (
    token = 'PxI28Q9rUFTMunqDa2z22X8C9+G1lvWKzh7abc95kzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028