UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ESiqZZW7eL59KjVDJvawPOOIm9ndrkW2X7e4Pr5ZXKQ=' 
WHERE 
  key_id = '8dcdd7e0c67565f7240d6c26b1179e38e57b0421c2fcd380ab98a0af36cf8428' 
  AND (
    token = 'ESiqZZW7eL59KjVDJvawPOOIm9ndrkW2X7e4Pr5ZXKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034