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