UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a4kJ9e7HJB4161MKZRgod+Dy4Vhx7kMjhAp0IH0ciRM='
WHERE
key_id = 'b3bfe4fda1be130c529de6f264ca00a3078a4ae28b09c6547e5789ad871baf0e'
AND (
token = 'a4kJ9e7HJB4161MKZRgod+Dy4Vhx7kMjhAp0IH0ciRM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)