UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dLyQAfsEvgmlJg5Q6isPYiMWyHMOBfIL7+VG7pSS5IM='
WHERE
key_id = 'a51ef58a0cf1ebd8b4a31f891e0dfa508be9b6523cba99c881530387031a46d2'
AND (
token = 'dLyQAfsEvgmlJg5Q6isPYiMWyHMOBfIL7+VG7pSS5IM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)