UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tA5C1+wkTEFX2jmN9Z7gJySg8U3ELoaryS9QDlehCQg='
WHERE
key_id = '59234c068f42e1ebeb8c78b93644145b73dccc8e7ca13c2d427bc2191e6d61d1'
AND (
token = 'tA5C1+wkTEFX2jmN9Z7gJySg8U3ELoaryS9QDlehCQg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)