UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PC1IWpKHGQirpoy9SsYRa095BB6nbbBE3CKWC9I5kf4='
WHERE
key_id = '017733d2ec785a69aa995227420c14f5af16ab2674c6be7c7f5a0ba6bfa28518'
AND (
token = 'PC1IWpKHGQirpoy9SsYRa095BB6nbbBE3CKWC9I5kf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)