UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gtzQj2TlsR0yA4u6pgRfiaH0Q4v8oVhq1OGMaM52mBY='
WHERE
key_id = '2f498a8995fc4bc41ee54cc27645f2247c8ed19b31c2379a6b621c3027c522ce'
AND (
token = 'gtzQj2TlsR0yA4u6pgRfiaH0Q4v8oVhq1OGMaM52mBY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)