UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C66b42PwHTtEfud+YUKXaXgEpmcLK+unR2CEiQV+iWU=' 
WHERE 
  key_id = '10fc946f563626f626f8776f91d0dc2743d676b868693e7946ff4784219e3c1e' 
  AND (
    token = 'C66b42PwHTtEfud+YUKXaXgEpmcLK+unR2CEiQV+iWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024