UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fMHbsXxul1mdkAzlEj40Jz6NU59TVHejYJEuJKRl+Rk='
WHERE
key_id = 'ae58b0b3dceee6cac4a1a04ce6238216c4cacdc6a72c395b2679d22bf037fbca'
AND (
token = 'fMHbsXxul1mdkAzlEj40Jz6NU59TVHejYJEuJKRl+Rk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)