UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yrp4ISilRDhRmYhHqi5ZmdB1dFwZPiMU6qoexEEiehw='
WHERE
key_id = 'a817c1019df9fdcd26903f27869f477abfedcfec5dcd61a2d370862d534fb26f'
AND (
token = 'yrp4ISilRDhRmYhHqi5ZmdB1dFwZPiMU6qoexEEiehw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)