UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HNEabWsWRjAaC/skHcQh5XbSeoVpPgB/q5JIajt78xc=' 
WHERE 
  key_id = '9b3e9beaad9afaa26e3afecec95fef36ff95a1445847787cadc270d376536a36' 
  AND (
    token = 'HNEabWsWRjAaC/skHcQh5XbSeoVpPgB/q5JIajt78xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040