UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ALcDaBLlt1sYq+3xz086145EP3AYfVfnaZ8rfTfOzcQ='
WHERE
key_id = 'a8c5aaab20b6e184309e7c156a65f08c60507898b941f926eed8905d8b7d9a7b'
AND (
token = 'ALcDaBLlt1sYq+3xz086145EP3AYfVfnaZ8rfTfOzcQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)