UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tZU5h4Uc6DkaM+thUO2wIb5Vl5L1lotMRynNJKSwFlU='
WHERE
key_id = 'b566cbdf4eba6ab89b636b22c15ee8cb4b52d05b71c7ddeda752d9c296d4a460'
AND (
token = 'tZU5h4Uc6DkaM+thUO2wIb5Vl5L1lotMRynNJKSwFlU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)