UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YY0XEOqJu67mf6cV6lOoTkjArqEYtgHLCySU/EwTw5g='
WHERE
key_id = '4e481c11898538312bf3b2056dae4e13afceda08ba9e5549bab14f0c13eacd88'
AND (
token = 'YY0XEOqJu67mf6cV6lOoTkjArqEYtgHLCySU/EwTw5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)