UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jrEYghwt5mZaTBuBwYb6XJ1M4TJqmfhA9teolaC3S+Q=' 
WHERE 
  key_id = '90112ebeacc56efc705a288b8c68c78acfb2bd577553905e1ba31994dd7de268' 
  AND (
    token = 'jrEYghwt5mZaTBuBwYb6XJ1M4TJqmfhA9teolaC3S+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034