UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Im+It3Vj4dUVmWNomH2AD0d0BjA3cb6yhlRIsRdcbh8='
WHERE
key_id = 'c1a14f3a7ba9855973aa239cc873985097ec528c6dde01ac6f003aced211e880'
AND (
token = 'Im+It3Vj4dUVmWNomH2AD0d0BjA3cb6yhlRIsRdcbh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)