UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'owpwcihkduYighJG3/pscX6SCjUYTn6Dm57dZr0tQQE=' 
WHERE 
  key_id = '27fbc54444657a3ddb111a2d3f8dfab34c6cce277c1d69cbe5b9d5c2983db579' 
  AND (
    token = 'owpwcihkduYighJG3/pscX6SCjUYTn6Dm57dZr0tQQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031