UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ei+dsvtjmaGlCI45o1Kk1KBgDm7NsRnYkONTLoH3+Q0=' 
WHERE 
  key_id = '984a5f56fa7627e33270846961f6a6fd649a4ae3be7427e7c0e1f274a5def162' 
  AND (
    token = 'ei+dsvtjmaGlCI45o1Kk1KBgDm7NsRnYkONTLoH3+Q0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023