UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x51xpoYtP1SIAY3vv2ZWLR1tCArul50+YzKhG/o1S9s=' 
WHERE 
  key_id = 'a363670819aeb62ece4d81afeea19792b25c8c2246a64fc841b6e943959537ba' 
  AND (
    token = 'x51xpoYtP1SIAY3vv2ZWLR1tCArul50+YzKhG/o1S9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021