UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f4WoRvp9wenh15N+k8iCE/JNzf+A47guI/GikwIctC4='
WHERE
key_id = '78a4b738de2880d6b3165cae45f48553be3f41df80f9bc1fcd73a4f378a39441'
AND (
token = 'f4WoRvp9wenh15N+k8iCE/JNzf+A47guI/GikwIctC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)