UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'elDyAVyySRhpyG0Zrb4Dxrj9awyhsAJTJHzfNT0f3GY=' 
WHERE 
  key_id = '99329634037bdc1467f98836f74c1812c9c7a8acab89594ead764c474ab06785' 
  AND (
    token = 'elDyAVyySRhpyG0Zrb4Dxrj9awyhsAJTJHzfNT0f3GY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043