UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PeiyTGXVpPiYwAUyKgrjS0W+OSNs1uCRyXZf4Sw6faw=' 
WHERE 
  key_id = '4b95b23bd211b856d00eaa66d94cbbfa25819ba51735f3787c95700d7e5bd029' 
  AND (
    token = 'PeiyTGXVpPiYwAUyKgrjS0W+OSNs1uCRyXZf4Sw6faw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041