UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c6bgruM6bjdeyTB0IIR9/p/1SulUsd9DWlw1XMAgBzk='
WHERE
key_id = '561e57f38c265464648393f4be21bb6a960d382a1e46f531507df1b5a89d41f8'
AND (
token = 'c6bgruM6bjdeyTB0IIR9/p/1SulUsd9DWlw1XMAgBzk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)