UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tpDBTHIYW5k1YOEznEqS/3rriy4c6U1DJ6niA98OsC8='
WHERE
key_id = '0567b2a72f4f3cfb3dcf50efe5c7ec3948c3e248a5f0470ee0d92e502f54c560'
AND (
token = 'tpDBTHIYW5k1YOEznEqS/3rriy4c6U1DJ6niA98OsC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)