UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rnca7nboLci8wwKRI5YXlql7x1aRgV9WeMs5lC+mL+M='
WHERE
key_id = '229340305b358ccc8766a84331b1a0d2d1255819413b5eb21505ae136f52ced2'
AND (
token = 'rnca7nboLci8wwKRI5YXlql7x1aRgV9WeMs5lC+mL+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)