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