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