UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L9v1fAgd4Bt+5alyRk8AXyKRs/VRA2EDgxci2njNXaI='
WHERE
key_id = 'ae9f20c47f09b39fb73aebe465542ce3494668462014474733bae85ce9731db5'
AND (
token = 'L9v1fAgd4Bt+5alyRk8AXyKRs/VRA2EDgxci2njNXaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)