UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0cb07P3hp2TY8g1d2v24IvF/1E5jZ9Qafm8RJaq1VVE='
WHERE
key_id = 'a568dd3691343e3e5b611bb68fe2f7379ca1994e1e653a77306048a068a51c24'
AND (
token = '0cb07P3hp2TY8g1d2v24IvF/1E5jZ9Qafm8RJaq1VVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)