UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tXZtd0Oxuh0s78Gvs0qudeI3hdKxvORhIw76Ewr/3Qw='
WHERE
key_id = '5458e0f9f0571a63ac1e75bb7c006be698f152ee9a3fcbf4591119b6913c1384'
AND (
token = 'tXZtd0Oxuh0s78Gvs0qudeI3hdKxvORhIw76Ewr/3Qw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)