UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vHjdbHe8N5m+rOFpteMC1Jtsy4EZayNim2OEkhyrbPc='
WHERE
key_id = '871ee4147844f3d14e73205e06ff492157cc7269eb900e9fa9b9c17c9e7bb7d8'
AND (
token = 'vHjdbHe8N5m+rOFpteMC1Jtsy4EZayNim2OEkhyrbPc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)