UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KYgGkSJeRg/U2sw6TmkmwH2IVkEhpuYQoJrhb/Z/nMY=' 
WHERE 
  key_id = '762fc0fcfbb5014460286af1cd87805bbbb4e2a13721acb08453ca7f7b008544' 
  AND (
    token = 'KYgGkSJeRg/U2sw6TmkmwH2IVkEhpuYQoJrhb/Z/nMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00090