UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PjCYn8Yl2szmvQ51utJT5FHqrNJntWQoO6x5YwDNKuU='
WHERE
key_id = 'e5de69f39fdd025aebcc8061c43f26fb06354d996235a012d4986d0da947edbc'
AND (
token = 'PjCYn8Yl2szmvQ51utJT5FHqrNJntWQoO6x5YwDNKuU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)