UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1AvP+L4F8fWowiZJzZ4jl1hnrsJaG61CnuBmjwZYJ9Q='
WHERE
key_id = 'e7f18e5b9eb03217855aafaf8d59edd7d2d3207c5c3df2fecc461dd3f7940aaf'
AND (
token = '1AvP+L4F8fWowiZJzZ4jl1hnrsJaG61CnuBmjwZYJ9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)