UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WX67TksVJiCtT/cq8g9j7tdtSV+hjdndKS9kD+fi+yw='
WHERE
key_id = 'a4b25765715732adb34b48a5453812ae9c65d9aa6cb1b182c1c1194bcdeca746'
AND (
token = 'WX67TksVJiCtT/cq8g9j7tdtSV+hjdndKS9kD+fi+yw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)