UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JMzgHNV2MwmnL5HTYS57vD4KRx+Q/bdGVcjDa7WL+NU=' 
WHERE 
  key_id = '9bc7ad11960f5299e1f740f25abadbc071ae4ac6d27a1b3653a6692b8853e237' 
  AND (
    token = 'JMzgHNV2MwmnL5HTYS57vD4KRx+Q/bdGVcjDa7WL+NU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067