UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f7frDdNGVo1WLiGnizYYuv041cuhW1ljPMPP9sJ+zI8='
WHERE
key_id = 'edce66fd29db9c91917264c4ab51e04f3d6258b1ac322858b4784fcaffe8f29c'
AND (
token = 'f7frDdNGVo1WLiGnizYYuv041cuhW1ljPMPP9sJ+zI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)